package com.cn.wanxi.service;

import com.cn.wanxi.dao.NavDao;
import com.cn.wanxi.model.NavModel;

public class NavService {

    /**
     * @return
     */
    public NavModel[] getNavModels() {
//        以后我们的代码不能出现固定数字？
        NavDao navDao = new NavDao();
        int length = navDao.hrefs.length;
        NavModel[] navModels = new NavModel[length];
        for (int i = 0; i < length; i++) {
            NavModel model = new NavModel();
            model.setHref(navDao.hrefs[i]);//取数组的值赋值给对象的属性
            model.setTitle(NavDao.TITLES[i]);
            navModels[i] = model;//将对象赋值给数组
        }
        return navModels;
    }
}
